package top.toptimus.dto.dbSync.syncDatas;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Map;

/**
 * 品牌DTO
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class BrandDTO {
    private String brand_name_cn;//品牌中文名称
    private String brand_id;       //品牌ID

    /**
     * 数据存放到map中
     *
     * @param map
     */
    public BrandDTO(Map<String, Object> map) {
        this.brand_name_cn = map.containsKey("inventory_material_id")?map.get("inventory_material_id").toString():"";
        this.brand_id = map.containsKey("material_quantity")?map.get("material_quantity").toString():"";

    }

    /**
     * 插入数据到a_brand_p表中
     *
     * @return
     */
    public String BrandInsertSql() {
        String sql = "INSERT INTO `fragsmart-erp`.`a_brand_p` ( `BRAND_NAME_CN`, `BRAND_ID` )\n" +
                "VALUES\n" +
                "	( " + this.brand_name_cn + ", " + this.brand_id + " );";

        return sql;
    }
}
